﻿using System.ComponentModel.DataAnnotations;
using OpusSuite.Utility;
using OpusSuite.Models.Model.Shared;
using OpusSuite.Globalisation.Attributes;
using OpusSuite.Globalisation.Resources;

namespace OpusSuite.Models.Model.Ref
{
    [Table("language")]
    public class Language : ModelBase
    {
        public int Id { get; set; }

        [OpusDisplay(Enums.OpusSuiteResource.Ref, "Language_Code_DisplayName")]
        //[OpusStringLength(Enums.OpusSuiteResource.Common, "StringLengthWarning", 2, 20)]
        [StringLength(20)]
        [Required(
            ErrorMessageResourceName = "Language_Code_Required",
            ErrorMessageResourceType = typeof(ModelRef)
            )]
        //[Remote("LanguageCodeAvailable", "Ref")]
        public string Code { get; set; }

        [StringLength(30)]
        public string Variant { get; set; }

        [OpusDisplay(Enums.OpusSuiteResource.Ref, "Language_Name_DisplayName")]
        //[OpusStringLength(Enums.OpusSuiteResource.Common, "StringLengthWarning", 2, 60)]
        [Required(
            ErrorMessageResourceName = "Language_Name_Required",
            ErrorMessageResourceType = typeof(ModelRef)
            )]
        [StringLength(30)]
        public string Name { get; set; }

        [OpusDisplay(Enums.OpusSuiteResource.Ref, "Language_Description_DisplayName")]
        [StringLength(256,
            ErrorMessageResourceName = "Language_Description_StringLengthWarning",
            ErrorMessageResourceType = typeof(ModelRef)
            )]
        [Required(
            ErrorMessageResourceName = "Language_Description_Required",
            ErrorMessageResourceType = typeof(ModelRef)
            )]
        public string Description { get; set; }
    }
}